#!/bin/bash
# 脚本目录
file_dir="/root/aml/dws/"
# 日志目录
log_dir="/root/aml/dws/logs/"
# 获取ETL时间
etl_dt=`date -d '-1 day' +"%Y-%m-%d"`

nohup hive -hivevar dt="$etl_dt" -f "$file_dir"dws.dws_aml_customer_risk_profile.sql > "$log_dir"-"dws.dws_aml_customer_risk_profile.sql"-"$etl_dt".log &
nohup hive -hivevar dt="$etl_dt" -f "$file_dir"dws.dws_aml_risk_dashboard.sql > "$log_dir"-"dws.dws_aml_risk_dashboard.sql"-"$etl_dt".log &
nohup hive -hivevar dt="$etl_dt" -f "$file_dir"dws.dws_aml_transaction_behavior.sql > "$log_dir"-"dws.dws_aml_transaction_behavior.sql"-"$etl_dt".log &

# 清理两天前的日志文件
rm -rf `find /root/test -mtime 2`